set -x

#Linux： 后面的值为要使用的GPU编号，正常的话是从0开始
export CUDA_VISIBLE_DEVICES=0,6,7
# windows: 
# set CUDA_VISIBLE_DEVICES=0


cp /mnt/afs/luotianhang/aoss.conf /root/
cp /mnt/afs/luotianhang/petreloss.conf /root/
export RESUME_MODEL='/mnt/afs/luotianhang/diffusers/examples/inpainting/sd_inpainting/checkpoint-43000'
# export MODEL_NAME='/mnt/afs2d/luotianhang/smartvehicle_diffusion/diffusers/examples/inpainting/pretrain'
# export MODEL_NAME='/mnt/afs2d/luotianhang/cache/PretrainedModels/models--runwayml--stable-diffusion-inpainting/snapshots/afeee10def38be19995784bcc811882409d066e5'
# export MODEL_NAME='/mnt/afs2d/luotianhang/cache/PretrainedModels/stable-diffusion-v1-5/stable-diffusion-v1-5'
export MODEL_NAME='/mnt/afs/luotianhang/models--stabilityai--stable-diffusion-3.5-medium/snapshots/b940f670f0eda2d07fbb75229e779da1ad11eb80'
# export MODEL_NAME='/mnt/afs2d/luotianhang/smartvehicle_diffusion/diffusers/examples/inpainting/pretrain_ppt'
accelerate launch  train_sd3.py \
    --pretrained_model_name_or_path=$MODEL_NAME \
    --resolution=128  \
    --train_batch_size=1 --gradient_accumulation_steps=4 --gradient_checkpointing \
    --max_train_steps=250000 \
    --checkpointing_steps=500 \
    --checkpoints_total_limit=2 \
    --learning_rate=1e-05 --max_grad_norm=1 --lr_warmup_steps=0 \
    --seed=423 \
    --num_workers=2 \
    --output_dir=sd_inpainting \
    --use_8bit_adam  \
    --mixed_precision=fp16 
    
    # --snr_gamma 5.0 \
    # --noise_offset 0.1
